import React from 'react'

export default function Todofooter(props) {
  let {connet,changvalueall,delall} = props
  // 已完成的个数
 let long =  connet.filter((iteam)=>{
    if(iteam.type===true){
     return iteam
    }
      })
// 全选全不选
let changeall=(e)=>{
  changvalueall(e.target.checked)

}
//删除全部

let delvalueall = ()=>{
  delall()
}

  return (
    <div className="todo-footer">
    <label>
        <input type="checkbox"  checked={connet.every((iteam) => iteam.type)} onChange={changeall} />
    </label>
    <span>
        <span>已完成{long.length }</span> / 全部{connet.length}
    </span>
    <button className="btn btn-danger" onClick={delvalueall}>清除已完成任务</button>
</div>
  )
}
